\(\int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx\) [44]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 142 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx=-\frac {3 (i A-3 B) x}{4 a^2}+\frac {(A+2 i B) \log (\cos (c+d x))}{a^2 d}+\frac {3 (i A-3 B) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2} \]

[Out]

-3/4*(I*A-3*B)*x/a^2+(A+2*I*B)*ln(cos(d*x+c))/a^2/d+3/4*(I*A-3*B)*tan(d*x+c)/a^2/d+1/2*(A+2*I*B)*tan(d*x+c)^2/
a^2/d/(1+I*tan(d*x+c))+1/4*(I*A-B)*tan(d*x+c)^3/d/(a+I*a*tan(d*x+c))^2

Rubi [A] (verified)

Time = 0.32 (sec) , antiderivative size = 142, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.088, Rules used = {3676, 3606, 3556} \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx=\frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {3 (-3 B+i A) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \log (\cos (c+d x))}{a^2 d}-\frac {3 x (-3 B+i A)}{4 a^2}+\frac {(-B+i A) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2} \]

[In]

Int[(Tan[c + d*x]^3*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^2,x]

[Out]

(-3*(I*A - 3*B)*x)/(4*a^2) + ((A + (2*I)*B)*Log[Cos[c + d*x]])/(a^2*d) + (3*(I*A - 3*B)*Tan[c + d*x])/(4*a^2*d
) + ((A + (2*I)*B)*Tan[c + d*x]^2)/(2*a^2*d*(1 + I*Tan[c + d*x])) + ((I*A - B)*Tan[c + d*x]^3)/(4*d*(a + I*a*T
an[c + d*x])^2)

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3606

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[b*d*(Tan[e + f*x]/f), x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3676

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(-(A*b - a*B))*(a + b*Tan[e + f*x])^m*((c + d*Tan[e + f*x])^n/(2*a*f
*m)), x] + Dist[1/(2*a^2*m), Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^(n - 1)*Simp[A*(a*c*m + b*d
*n) - B*(b*c*m + a*d*n) - d*(b*B*(m - n) - a*A*(m + n))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A
, B}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0] && GtQ[n, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2}-\frac {\int \frac {\tan ^2(c+d x) (3 a (i A-B)+a (A+5 i B) \tan (c+d x))}{a+i a \tan (c+d x)} \, dx}{4 a^2} \\ & = \frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2}+\frac {\int \tan (c+d x) \left (-8 a^2 (A+2 i B)+6 a^2 (i A-3 B) \tan (c+d x)\right ) \, dx}{8 a^4} \\ & = -\frac {3 (i A-3 B) x}{4 a^2}+\frac {3 (i A-3 B) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2}-\frac {(A+2 i B) \int \tan (c+d x) \, dx}{a^2} \\ & = -\frac {3 (i A-3 B) x}{4 a^2}+\frac {(A+2 i B) \log (\cos (c+d x))}{a^2 d}+\frac {3 (i A-3 B) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.51 (sec) , antiderivative size = 197, normalized size of antiderivative = 1.39 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx=\frac {(7 A+17 i B) \log (i-\tan (c+d x))+(A-i B) \log (i+\tan (c+d x))+2 (-3 i A+9 B+(7 i A-17 B) \log (i-\tan (c+d x))+(i A+B) \log (i+\tan (c+d x))) \tan (c+d x)+(8 A+28 i B-(7 A+17 i B) \log (i-\tan (c+d x))-(A-i B) \log (i+\tan (c+d x))) \tan ^2(c+d x)-8 B \tan ^3(c+d x)}{8 a^2 d (-i+\tan (c+d x))^2} \]

[In]

Integrate[(Tan[c + d*x]^3*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^2,x]

[Out]

((7*A + (17*I)*B)*Log[I - Tan[c + d*x]] + (A - I*B)*Log[I + Tan[c + d*x]] + 2*((-3*I)*A + 9*B + ((7*I)*A - 17*
B)*Log[I - Tan[c + d*x]] + (I*A + B)*Log[I + Tan[c + d*x]])*Tan[c + d*x] + (8*A + (28*I)*B - (7*A + (17*I)*B)*
Log[I - Tan[c + d*x]] - (A - I*B)*Log[I + Tan[c + d*x]])*Tan[c + d*x]^2 - 8*B*Tan[c + d*x]^3)/(8*a^2*d*(-I + T
an[c + d*x])^2)

Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 173, normalized size of antiderivative = 1.22

method result size
derivativedivides \(-\frac {B \tan \left (d x +c \right )}{d \,a^{2}}-\frac {A}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {i B}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {A \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d \,a^{2}}-\frac {3 i A \arctan \left (\tan \left (d x +c \right )\right )}{4 d \,a^{2}}-\frac {i B \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d \,a^{2}}+\frac {9 B \arctan \left (\tan \left (d x +c \right )\right )}{4 d \,a^{2}}+\frac {5 i A}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )}-\frac {7 B}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )}\) \(173\)
default \(-\frac {B \tan \left (d x +c \right )}{d \,a^{2}}-\frac {A}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {i B}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {A \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d \,a^{2}}-\frac {3 i A \arctan \left (\tan \left (d x +c \right )\right )}{4 d \,a^{2}}-\frac {i B \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d \,a^{2}}+\frac {9 B \arctan \left (\tan \left (d x +c \right )\right )}{4 d \,a^{2}}+\frac {5 i A}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )}-\frac {7 B}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )}\) \(173\)
risch \(\frac {17 x B}{4 a^{2}}-\frac {7 i x A}{4 a^{2}}-\frac {3 i {\mathrm e}^{-2 i \left (d x +c \right )} B}{4 a^{2} d}-\frac {{\mathrm e}^{-2 i \left (d x +c \right )} A}{2 a^{2} d}+\frac {i {\mathrm e}^{-4 i \left (d x +c \right )} B}{16 a^{2} d}+\frac {{\mathrm e}^{-4 i \left (d x +c \right )} A}{16 a^{2} d}+\frac {4 B c}{a^{2} d}-\frac {2 i A c}{a^{2} d}-\frac {2 i B}{d \,a^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {2 i \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{a^{2} d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A}{a^{2} d}\) \(177\)

[In]

int(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

-1/d/a^2*B*tan(d*x+c)-1/4/d/a^2/(tan(d*x+c)-I)^2*A-1/4*I/d/a^2/(tan(d*x+c)-I)^2*B-1/2/d/a^2*A*ln(1+tan(d*x+c)^
2)-3/4*I/d/a^2*A*arctan(tan(d*x+c))-I/d/a^2*B*ln(1+tan(d*x+c)^2)+9/4/d/a^2*B*arctan(tan(d*x+c))+5/4*I/d/a^2/(t
an(d*x+c)-I)*A-7/4/d/a^2/(tan(d*x+c)-I)*B

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.06 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx=-\frac {4 \, {\left (7 i \, A - 17 \, B\right )} d x e^{\left (6 i \, d x + 6 i \, c\right )} + 4 \, {\left ({\left (7 i \, A - 17 \, B\right )} d x + 2 \, A + 11 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (7 \, A + 11 i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} - 16 \, {\left ({\left (A + 2 i \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (A + 2 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - A - i \, B}{16 \, {\left (a^{2} d e^{\left (6 i \, d x + 6 i \, c\right )} + a^{2} d e^{\left (4 i \, d x + 4 i \, c\right )}\right )}} \]

[In]

integrate(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/16*(4*(7*I*A - 17*B)*d*x*e^(6*I*d*x + 6*I*c) + 4*((7*I*A - 17*B)*d*x + 2*A + 11*I*B)*e^(4*I*d*x + 4*I*c) +
(7*A + 11*I*B)*e^(2*I*d*x + 2*I*c) - 16*((A + 2*I*B)*e^(6*I*d*x + 6*I*c) + (A + 2*I*B)*e^(4*I*d*x + 4*I*c))*lo
g(e^(2*I*d*x + 2*I*c) + 1) - A - I*B)/(a^2*d*e^(6*I*d*x + 6*I*c) + a^2*d*e^(4*I*d*x + 4*I*c))

Sympy [A] (verification not implemented)

Time = 0.44 (sec) , antiderivative size = 262, normalized size of antiderivative = 1.85 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx=- \frac {2 i B}{a^{2} d e^{2 i c} e^{2 i d x} + a^{2} d} + \begin {cases} \frac {\left (\left (4 A a^{2} d e^{2 i c} + 4 i B a^{2} d e^{2 i c}\right ) e^{- 4 i d x} + \left (- 32 A a^{2} d e^{4 i c} - 48 i B a^{2} d e^{4 i c}\right ) e^{- 2 i d x}\right ) e^{- 6 i c}}{64 a^{4} d^{2}} & \text {for}\: a^{4} d^{2} e^{6 i c} \neq 0 \\x \left (- \frac {- 7 i A + 17 B}{4 a^{2}} + \frac {\left (- 7 i A e^{4 i c} + 4 i A e^{2 i c} - i A + 17 B e^{4 i c} - 6 B e^{2 i c} + B\right ) e^{- 4 i c}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} + \frac {x \left (- 7 i A + 17 B\right )}{4 a^{2}} + \frac {\left (A + 2 i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a^{2} d} \]

[In]

integrate(tan(d*x+c)**3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))**2,x)

[Out]

-2*I*B/(a**2*d*exp(2*I*c)*exp(2*I*d*x) + a**2*d) + Piecewise((((4*A*a**2*d*exp(2*I*c) + 4*I*B*a**2*d*exp(2*I*c
))*exp(-4*I*d*x) + (-32*A*a**2*d*exp(4*I*c) - 48*I*B*a**2*d*exp(4*I*c))*exp(-2*I*d*x))*exp(-6*I*c)/(64*a**4*d*
*2), Ne(a**4*d**2*exp(6*I*c), 0)), (x*(-(-7*I*A + 17*B)/(4*a**2) + (-7*I*A*exp(4*I*c) + 4*I*A*exp(2*I*c) - I*A
 + 17*B*exp(4*I*c) - 6*B*exp(2*I*c) + B)*exp(-4*I*c)/(4*a**2)), True)) + x*(-7*I*A + 17*B)/(4*a**2) + (A + 2*I
*B)*log(exp(2*I*d*x) + exp(-2*I*c))/(a**2*d)

Maxima [F(-2)]

Exception generated. \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negative exponent.

Giac [A] (verification not implemented)

none

Time = 0.68 (sec) , antiderivative size = 120, normalized size of antiderivative = 0.85 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx=-\frac {\frac {2 \, {\left (A - i \, B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a^{2}} + \frac {2 \, {\left (7 \, A + 17 i \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a^{2}} + \frac {16 \, B \tan \left (d x + c\right )}{a^{2}} - \frac {21 \, A \tan \left (d x + c\right )^{2} + 51 i \, B \tan \left (d x + c\right )^{2} - 22 i \, A \tan \left (d x + c\right ) + 74 \, B \tan \left (d x + c\right ) - 5 \, A - 27 i \, B}{a^{2} {\left (\tan \left (d x + c\right ) - i\right )}^{2}}}{16 \, d} \]

[In]

integrate(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-1/16*(2*(A - I*B)*log(tan(d*x + c) + I)/a^2 + 2*(7*A + 17*I*B)*log(tan(d*x + c) - I)/a^2 + 16*B*tan(d*x + c)/
a^2 - (21*A*tan(d*x + c)^2 + 51*I*B*tan(d*x + c)^2 - 22*I*A*tan(d*x + c) + 74*B*tan(d*x + c) - 5*A - 27*I*B)/(
a^2*(tan(d*x + c) - I)^2))/d

Mupad [B] (verification not implemented)

Time = 7.78 (sec) , antiderivative size = 141, normalized size of antiderivative = 0.99 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx=\frac {\frac {\left (A+B\,2{}\mathrm {i}\right )\,1{}\mathrm {i}}{a^2}+\frac {B}{2\,a^2}-\mathrm {tan}\left (c+d\,x\right )\,\left (\frac {5\,\left (A+B\,2{}\mathrm {i}\right )}{4\,a^2}-\frac {B\,3{}\mathrm {i}}{4\,a^2}\right )}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{8\,a^2\,d}-\frac {B\,\mathrm {tan}\left (c+d\,x\right )}{a^2\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (7\,A+B\,17{}\mathrm {i}\right )}{8\,a^2\,d} \]

[In]

int((tan(c + d*x)^3*(A + B*tan(c + d*x)))/(a + a*tan(c + d*x)*1i)^2,x)

[Out]

(((A + B*2i)*1i)/a^2 + B/(2*a^2) - tan(c + d*x)*((5*(A + B*2i))/(4*a^2) - (B*3i)/(4*a^2)))/(d*(2*tan(c + d*x)
+ tan(c + d*x)^2*1i - 1i)) + (log(tan(c + d*x) + 1i)*(A*1i + B)*1i)/(8*a^2*d) - (B*tan(c + d*x))/(a^2*d) - (lo
g(tan(c + d*x) - 1i)*(7*A + B*17i))/(8*a^2*d)